/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package l1j.jrwz.server.templates;

import l1j.jrwz.server.datatables.NpcTable;
import l1j.jrwz.server.utils.IntRange;

public class L1PetType {
    public static int getMessageNumber(int level) {
        if (50 <= level) {
            return 5;
        }
        if (48 <= level) {
            return 4;
        }
        if (36 <= level) {
            return 3;
        }
        if (24 <= level) {
            return 2;
        }
        if (12 <= level) {
            return 1;
        }
        return 0;
    }

    private final int _baseNpcId;

    private final L1Npc _baseNpcTemplate;

    private final String _name;

    private final int _itemIdForTaming;

    private final IntRange _hpUpRange;

    private final IntRange _mpUpRange;

    private final int _npcIdForEvolving;

    private final int _msgIds[];

    private final int _defyMsgId;

    /** 进化道具ID. */
    private final int _evolvItemId;

    /** 是否可使用装备. */
    private final boolean _canUseEquipment;

    public L1PetType(int baseNpcId, String name, int itemIdForTaming,
            IntRange hpUpRange, IntRange mpUpRange, int evolvItemId,
            int npcIdForEvolving, int msgIds[], int defyMsgId,
            boolean canUseEquipment) {
        _baseNpcId = baseNpcId;
        _baseNpcTemplate = NpcTable.getInstance().getTemplate(baseNpcId);
        _name = name;
        _itemIdForTaming = itemIdForTaming;
        _hpUpRange = hpUpRange;
        _mpUpRange = mpUpRange;
        _evolvItemId = evolvItemId;
        _npcIdForEvolving = npcIdForEvolving;
        _msgIds = msgIds;
        _defyMsgId = defyMsgId;
        _canUseEquipment = canUseEquipment;
    }

    public boolean canEvolve() {
        return _npcIdForEvolving != 0;
    }

    public boolean canTame() {
        return _itemIdForTaming != 0;
    }

    public int getBaseNpcId() {
        return _baseNpcId;
    }

    public L1Npc getBaseNpcTemplate() {
        return _baseNpcTemplate;
    }

    public int getDefyMessageId() {
        return _defyMsgId;
    }

    /**
     * 取得进化道具.
     * 
     * @return 进化道具
     */
    public int getEvolvItemId() {
        return _evolvItemId;
    }

    /**
     * 是否可使用装备.
     * 
     * @return True：能、False：否
     */
    public boolean canUseEquipment() {
        return _canUseEquipment;
    }

    public IntRange getHpUpRange() {
        return _hpUpRange;
    }

    public int getItemIdForTaming() {
        return _itemIdForTaming;
    }

    public int getMessageId(int num) {
        if (num == 0) {
            return 0;
        }
        return _msgIds[num - 1];
    }

    public IntRange getMpUpRange() {
        return _mpUpRange;
    }

    public String getName() {
        return _name;
    }

    public int getNpcIdForEvolving() {
        return _npcIdForEvolving;
    }

}
